package com.shalanzi.hospital.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author Dream_飞翔
 * @date 2021/9/25
 * @time 19:31
 * @email 1072876976@qq.com
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultInfo implements Serializable {
    private Integer code;
    private String msg;
    private Object data;

    public static ResultInfo fail() {
        return new ResultInfo(201, "业务执行失败! ", null);
    }

    public static ResultInfo fail(String msg) {
        return new ResultInfo(201, msg, null);
    }

    public static ResultInfo success() {
        return new ResultInfo(200, "业务执行成功! ", null);
    }

    public static ResultInfo success(String msg) {
        return new ResultInfo(200, msg, null);
    }

    public static ResultInfo success(Object data) {
        return new ResultInfo(200, "业务执行成功! ", data);
    }

    public static ResultInfo success(String msg, Object data) {
        return new ResultInfo(200, msg, data);
    }
}
